In [ ]:
# Import packages
import pandas as pd
import numpy as np
import os

# Plot Figures
import plotly.graph_objects as go
import chart_studio.plotly as py
import cufflinks as cf
import seaborn as sns
import matplotlib.pyplot as plt
cf.go_offline()

BATH_PATH = os.getcwd()
ETC_PATH = os.path.join(BATH_PATH, "..", "etc")
DATA_PATH = os.path.join(BATH_PATH, "..", "data")

Meta_table_file = os.path.join(ETC_PATH, "rtem_all_points_metadata.csv")
In [ ]:
# Extract Necessary meta of building
def extract_necessary_meta(building_id):
    # Preprocess
    Meta_table_DF = pd.read_csv(Meta_table_file)
    Meta_table_DF.loc[:, "units"] = np.where(Meta_table_DF.loc[:, "units"].isna(), Meta_table_DF.loc[:, "tagged_units"], Meta_table_DF.loc[:, "units"])
    Meta_table_DF.loc[:, "name_point"] = np.where(Meta_table_DF.loc[:, "name_point"].isna(), Meta_table_DF.loc[:, "description"], Meta_table_DF.loc[:, "name_point"])
    # Select columns/building_id
    select_cols = ["id_point", "building_id", "name_point", "description", "units", "tagged_units", "equip_id", "equip_type_abbr", "equip_type_name", "tags"]
    Meta_table_DF = Meta_table_DF[Meta_table_DF["building_id"]==building_id][select_cols]
    return Meta_table_DF

building_id = 438
extract_necessary_meta(building_id)
Out[ ]:
id_point building_id name_point description units tagged_units equip_id equip_type_abbr equip_type_name tags
7793 308715 438 AOLTW.FPMETER-053.SM-020 NaN kWh kwh 28550 METER Meter ['meter', 'elecMeter']
7794 308716 438 AOLTW.FPMETER-053.WM-014 NaN kWh kwh 28551 METER Meter ['meter', 'elecMeter']
7795 308008 438 Base Building AHU-37N-1_Final Filter Pressure ... NaN On/Off on/off 28552 AHU Air Handling Unit ['ahu', 'hvac']
7796 308007 438 Base Building AHU-37N-1_Cooling Coil Valve Com... NaN % % 28552 AHU Air Handling Unit ['ahu', 'hvac']
7797 308009 438 Base Building AHU-37N-1_Occupied Mode NaN Occ occ 28552 AHU Air Handling Unit ['ahu', 'hvac']
... ... ... ... ... ... ... ... ... ... ...
8899 308710 438 AOLTW.FPMETER-046.SM-019 NaN kWh kwh 28766 METER Meter ['meter', 'elecMeter']
8900 308711 438 AOLTW.FPMETER-050.BM-381 NaN kWh kwh 28767 METER Meter ['meter', 'elecMeter']
8901 308712 438 AOLTW.FPMETER-050.BM-382 NaN kWh kwh 28768 METER Meter ['meter', 'elecMeter']
8902 308713 438 AOLTW.FPMETER-052.BM-0CT NaN kWh kwh 28769 METER Meter ['meter', 'elecMeter']
8903 308714 438 AOLTW.FPMETER-052.WM-015 NaN kWh kwh 28770 METER Meter ['meter', 'elecMeter']

1111 rows × 10 columns

In [ ]:
# Save meta for building
def save_meta_building(building_id):
    DF = extract_necessary_meta(building_id)
    DF.reset_index(drop=True, inplace=True)
    try:
        DF.to_csv(os.path.join(DATA_PATH, F"Building_{building_id}", F"Meta_Building_{building_id}.csv"))
        return print(F"Meta_Building_{building_id}.csv saved!")
    except:
        return print(F"Meta_Building_{building_id}.csv saving failed!")

building_id = 438
save_meta_building(building_id)
Meta_Building_438.csv saved!
In [ ]:
# Merge Building Data
def merge_building_data(building_id):
    Building_Data_path = os.path.join(DATA_PATH, F"Building_{building_id}")
    Building_Data_List = [device for device in os.listdir(Building_Data_path) if "rtem_API_data" in device]
    data_list = []
    for device in Building_Data_List:
        temp_data = pd.read_csv(os.path.join(DATA_PATH, F"Building_{building_id}", device))
        temp_data.set_index("timestamp", inplace=True)
        data_list.append(temp_data)
    res_DF = pd.concat(data_list, axis=1, join="outer")
    res_DF.index = pd.to_datetime(res_DF.index)
    for col in res_DF:
        res_DF.loc[:, col] = pd.to_numeric(res_DF.loc[:, col])
    return res_DF

building_id = 438
merged_data = merge_building_data(building_id)
display(merged_data)
308439 308007 308008 308009 308011 307611 308010 307602 307608 307605 ... 308573 308574 308575 308576 308577 308718 308717 308720 308719 308721
timestamp
2020-05-01 04:00:00+00:00 NaN 99.0 0 1 1 0.00 62.0 0 70.65 70.01 ... 0 1 1 0 0 46.8 1.0 44.6 1.0 1
2020-05-01 04:15:00+00:00 NaN 100.0 0 1 1 0.00 62.0 0 70.88 70.08 ... 0 1 1 0 0 46.8 1.0 44.6 1.0 1
2020-05-01 04:30:00+00:00 NaN 99.0 0 1 1 0.00 62.0 0 71.05 70.13 ... 0 1 1 0 0 46.8 1.0 44.6 1.0 1
2020-05-01 04:45:00+00:00 NaN 100.0 0 1 1 0.00 62.0 0 71.20 70.17 ... 0 1 1 0 0 46.8 1.0 44.6 1.0 1
2020-05-01 05:00:00+00:00 NaN 100.0 0 1 1 0.00 62.0 0 71.35 70.23 ... 0 1 1 0 0 46.8 1.0 44.6 1.0 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
2020-10-31 23:00:00+00:00 NaN 0.0 0 0 0 60.30 62.0 0 64.00 66.66 ... 0 1 1 0 0 47.3 1.0 0.0 0.0 0
2020-10-31 23:15:00+00:00 NaN 0.0 0 0 0 60.38 62.0 0 66.43 66.61 ... 0 1 1 0 0 47.3 1.0 0.0 0.0 0
2020-10-31 23:30:00+00:00 NaN 0.0 0 0 0 60.31 62.0 0 64.25 66.53 ... 0 1 1 0 0 47.3 1.0 0.0 0.0 0
2020-10-31 23:45:00+00:00 NaN 0.0 0 0 0 60.49 62.0 0 64.51 66.61 ... 0 1 1 0 0 47.3 1.0 0.0 0.0 0
2020-11-01 00:00:00+00:00 NaN 0.0 0 0 0 60.44 62.0 0 66.30 66.55 ... 0 1 1 0 0 47.3 1.0 0.0 0.0 0

17645 rows × 1111 columns

In [ ]:
# Select columns and standardize column names
def standardize_column_names(building_id):
    Building_Data_path = os.path.join(DATA_PATH, F"Building_{building_id}")
    # Point_Table
    Point_table_file = [point_table for point_table in os.listdir(Building_Data_path) if ("Point_Table" in point_table) & (point_table.endswith("v2.xlsx"))]
    Point_table = pd.read_excel(os.path.join(DATA_PATH, F"Building_{building_id}", Point_table_file[0]))
    Point_table.sort_values(by="Point_ID", inplace=True)
    select_cols = [str(col) for col in Point_table.loc[:, "Point_ID"]]
    # Process data
    data = merge_building_data(building_id).loc[:, select_cols]
    data.columns = list(Point_table.loc[:, "Standardized_Point_Name"])
    for idx in Point_table.index:
        if (Point_table.loc[idx, "Unit"] == "F") or (Point_table.loc[idx, "Unit"] == "f"):
            data.loc[:, Point_table.loc[idx, "Standardized_Point_Name"]] = (data.loc[:, Point_table.loc[idx, "Standardized_Point_Name"]].values - 32) * 5 / 9
        if (Point_table.loc[idx, "Unit"] == "GPM") or (Point_table.loc[idx, "Unit"] == "gpm"): # GPM to LPH
            data.loc[:, Point_table.loc[idx, "Standardized_Point_Name"]] = (data.loc[:, Point_table.loc[idx, "Standardized_Point_Name"]].values) * 227.1
    return data
    
building_id = 438
merged_data = standardize_column_names(building_id)
display(merged_data.head(5))

# OUTPUT_DATA_PATH = os.path.join(BATH_PATH, "..", "data", F"Building_{building_id}", "output_data")
# merged_data.to_csv(os.path.join(OUTPUT_DATA_PATH, F"merged_data_{building_id}.csv"))
# print(F"merged_data_{building_id} data saved!")
AHU_37N_1_B-AHU_CCVC AHU_37N_1_B-AHU_OCC AHU_37N_1_B-AHU_TAS_SP AHU_38N_1_B-AHU_CCVC AHU_38N_1_B-AHU_OCC AHU_38N_1_B-AHU_TAS AHU_38N_1_B-AHU_TAS_SP AHU_C1_15_B-AHU_CCVC AHU_C1_15_B-AHU_OCC AHU_C1_15_B-AHU_TAS ... CH_22_4_B-TCWS CH_22_4_B-TCHS CH_22_4_B-TCHS_SP CH_22_4_B-IPCT CH_22_4_B-CH_KW CT_1_B-TCWR_1 CT_2_B-TCWR_2 CT_3_B-TCWR_3 CT_4_B-TCWR_4 CT_5_B-TCWR_5
timestamp
2020-05-01 04:00:00+00:00 99.0 1 16.666667 32.0 1 20.277778 20.255556 36.0 1 20.555556 ... 17.572222 13.694444 4.444444 0.0 0.0 13.777778 12.166667 12.277778 12.444444 12.333333
2020-05-01 04:15:00+00:00 100.0 1 16.666667 33.0 1 20.277778 20.255556 36.0 1 19.722222 ... 17.466667 13.505556 4.444444 0.0 0.0 13.277778 12.055556 12.166667 12.333333 12.111111
2020-05-01 04:30:00+00:00 99.0 1 16.666667 34.0 1 20.277778 20.255556 35.0 1 20.833333 ... 17.444444 13.511111 4.444444 0.0 0.0 13.000000 11.888889 12.111111 12.222222 12.000000
2020-05-01 04:45:00+00:00 100.0 1 16.666667 33.0 1 20.277778 20.255556 35.0 1 19.166667 ... 17.372222 13.538889 4.444444 0.0 0.0 13.000000 11.944444 12.166667 12.222222 12.055556
2020-05-01 05:00:00+00:00 100.0 1 16.666667 32.0 1 20.277778 20.255556 35.0 1 19.444444 ... 17.316667 13.511111 4.444444 0.0 0.0 13.055556 11.944444 12.166667 12.222222 12.000000

5 rows × 71 columns

In [ ]:
# Split Building Device 
def split_building_device(building_id):
    Building_Data_path = os.path.join(DATA_PATH, F"Building_{building_id}")
    Point_table_file = [point_table for point_table in os.listdir(Building_Data_path) if ("Point_Table" in point_table) & (point_table.endswith("v2.xlsx"))]
    Device_Table = pd.read_excel(os.path.join(DATA_PATH, F"Building_{building_id}", Point_table_file[0]), sheet_name="Device_class")
    Device_Table["Keywords"] = [keyword.replace(";", "|") for keyword in Device_Table["Keywords"]]
    data = standardize_column_names(building_id)
    # Classify Points by Device_Name
    Chiller_dictionary = {}
    filter_Table = pd.DataFrame.from_dict({"TCHD_cal":[0, 10], "RT_cal":[0, 50000], "CH_KW":[0, 50000], "KWRT_cal":[0, 3], "COP_cal":[0, 10]}, orient="index", columns=["Filter_bottom", "Filter_top"])
    for idx in Device_Table.index:
        chiller_name = Device_Table.loc[idx, "Device_Name"]
        chiller_data_cols = data.columns.str.contains(Device_Table.loc[idx, "Keywords"], regex=True)
        chiller_data = data.loc[:, chiller_data_cols].copy()
        if "CH" in chiller_name:
            for col in chiller_data.columns:
                try:
                    chiller_data.rename(columns={col: F'{col.split("-")[1]}'}, inplace=True)
                except:
                    pass
            chiller_data.drop(["CH_KWH"], axis=1, inplace=True)
            # Process chiller_data
            TCHD = chiller_data.loc[:, "TCHR"].values - chiller_data.loc[:, "TCHS"].values
            RT_cal = chiller_data.loc[:, "QCH"].values * TCHD / 3024 # USRT
            # RT_cal = chiller_data.loc[:, "QCH"].values * TCHD * 1000/3600 * 4.2 / 3.516
            KWRT_cal = chiller_data.loc[:, "CH_KW"] / RT_cal
            COP_cal = 3.516 / KWRT_cal
            chiller_data.loc[:, "TCHD_cal"] = TCHD
            chiller_data.loc[:, "RT_cal"] = RT_cal
            chiller_data.loc[:, "KWRT_cal"] = KWRT_cal
            chiller_data.loc[:, "COP_cal"] = COP_cal
        
            for col in chiller_data.columns:
                if col in filter_Table.index:
                    chiller_data.loc[:, col] = np.where(np.logical_or(chiller_data.loc[:, col]>filter_Table.loc[col, "Filter_top"], chiller_data.loc[:, col]<filter_Table.loc[col, "Filter_bottom"]), np.nan, chiller_data.loc[:, col])

        Chiller_dictionary[chiller_name] = chiller_data.dropna()
            
    return Chiller_dictionary

Chillers = split_building_device(building_id)
OUTPUT_DATA_PATH = os.path.join(BATH_PATH, "..", "data", F"Building_{building_id}", "output_data")

for chiller in Chillers.keys():
    temp_df = Chillers[chiller]
    display(temp_df.head(5))
    temp_df.to_csv(os.path.join(OUTPUT_DATA_PATH, F"{chiller}_data.csv"))
    print(F"{chiller} data saved!")
    
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT CH_KW TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal
timestamp
2020-05-01 11:00:00+00:00 867.7 36.2 10.6 27.4 488405.802 8.622222 23.922222 3.911111 4.444444 1086.01 579.57 13.166667 15.722222 18.944444 15.888889 18.333333 4.711111 760.890873 0.761699 4.615995
2020-05-01 11:15:00+00:00 867.7 36.2 10.0 27.4 469813.125 7.955556 23.505556 3.222222 4.444444 1042.88 557.03 13.222222 15.277778 19.055556 15.722222 18.388889 4.733333 735.377687 0.757475 4.641739
2020-05-01 11:30:00+00:00 867.7 36.0 10.5 27.4 479889.552 7.461111 21.405556 2.688889 4.444444 898.14 483.28 13.277778 15.555556 18.222222 18.388889 17.111111 4.772222 757.321291 0.638144 5.509729
2020-05-01 11:45:00+00:00 867.7 36.0 10.5 27.4 479181.000 7.088889 23.005556 2.627778 4.444444 830.20 456.86 13.444444 21.722222 18.333333 18.388889 21.833333 4.461111 706.904657 0.646282 5.440347
2020-05-01 12:00:00+00:00 867.7 36.0 9.6 27.4 470664.750 6.761111 25.183333 2.672222 4.444444 765.71 431.78 13.611111 23.333333 18.722222 18.333333 23.388889 4.088889 636.407363 0.678465 5.182288
CH_22_3 data saved!
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT CH_KW TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal
timestamp
2020-07-20 15:30:00+00:00 706.0 58.1 47.7 49.2 841830.177 9.672222 30.161111 5.850000 4.444444 898.24 483.32 23.166667 23.611111 23.222222 23.222222 23.777778 3.822222 1064.041670 0.454230 7.740566
2020-07-20 15:45:00+00:00 706.0 65.1 58.2 52.8 659298.552 10.372222 29.161111 5.938889 4.444444 776.45 435.95 23.166667 23.611111 23.111111 23.222222 23.833333 4.433333 966.564235 0.451031 7.795481
2020-07-20 16:00:00+00:00 706.0 44.7 25.0 39.3 485994.000 12.072222 29.100000 6.200000 4.444444 908.74 488.47 23.277778 23.666667 23.333333 23.277778 23.888889 5.872222 943.738349 0.517590 6.793015
2020-07-20 16:15:00+00:00 706.0 49.1 32.3 39.5 521903.052 12.188889 29.761111 6.133333 4.444444 921.81 495.15 23.500000 23.777778 23.611111 23.611111 24.166667 6.055556 1045.110095 0.473778 7.421200
2020-07-20 16:30:00+00:00 706.0 46.8 28.4 39.5 500471.625 11.933333 29.844444 5.827778 4.444444 936.06 502.43 23.722222 23.722222 23.833333 23.500000 23.944444 6.105556 1010.468687 0.497225 7.071250
CH_22_4 data saved!
AHU_37N_1_B-AHU_CCVC AHU_37N_1_B-AHU_OCC AHU_37N_1_B-AHU_TAS_SP AHU_38N_1_B-AHU_CCVC AHU_38N_1_B-AHU_OCC AHU_38N_1_B-AHU_TAS AHU_38N_1_B-AHU_TAS_SP AHU_C1_15_B-AHU_CCVC AHU_C1_15_B-AHU_OCC AHU_C1_15_B-AHU_TAS AHU_C1_15_B-AHU_TAS_SP AHU_C1_7_B-AHU_CCVC AHU_C1_7_B-AHU_OCC AHU_C1_7_B-AHU_TAS AHU_C1_7_B-AHU_TAS_SP AHU_C2_5_B-AHU_CCVC AHU_C2_5_B-AHU_OCC AHU_C2_5_B-AHU_TAS AHU_C2_5_B-AHU_TAS_SP
timestamp
2020-05-01 04:00:00+00:00 99.0 1 16.666667 32.0 1 20.277778 20.255556 36.0 1 20.555556 20.0 85.0 1 15.600000 15.555556 0.0 1.0 14.544444 12.777778
2020-05-01 04:15:00+00:00 100.0 1 16.666667 33.0 1 20.277778 20.255556 36.0 1 19.722222 20.0 84.0 1 15.572222 15.555556 0.0 1.0 14.544444 12.777778
2020-05-01 04:30:00+00:00 99.0 1 16.666667 34.0 1 20.277778 20.255556 35.0 1 20.833333 20.0 81.0 1 15.572222 15.555556 0.0 1.0 14.544444 12.777778
2020-05-01 04:45:00+00:00 100.0 1 16.666667 33.0 1 20.277778 20.255556 35.0 1 19.166667 20.0 82.0 1 15.572222 15.555556 0.0 1.0 14.544444 12.777778
2020-05-01 05:00:00+00:00 100.0 1 16.666667 32.0 1 20.277778 20.255556 35.0 1 19.444444 20.0 79.0 1 15.511111 15.555556 0.0 1.0 14.544444 12.777778
AHU data saved!
In [ ]:
# Merge HVAC related data
def merge_HVAC_data(CH_mode, AHU_Device):
    OUTPUT_DATA_PATH = os.path.join(BATH_PATH, "..", "data", F"Building_{building_id}", "output_data")
    # HVAC_data_path = os.path.join()
    HVAC_data_list = [CH_mode, AHU_Device] if CH_mode!="Mix" else ["CH_22_3", "CH_22_4", AHU_Device]
    data_list = []
    if CH_mode == "Mix":
        for data in HVAC_data_list:
            temp = pd.read_csv(os.path.join(OUTPUT_DATA_PATH, F"{data}_data.csv"))
            temp.set_index("timestamp", inplace=True)
            if "CH" in data:
                temp.columns = [F"{data}-{col}" for col in temp.columns]
            if "AHU" in data:
                temp.columns = [F"{col.split('-')[1]}" for col in temp.columns]
            data_list.append(temp)
        Res_DF = pd.concat(data_list, axis=1, join="outer")
        Res_DF.loc[:, "Total_RT"] = Res_DF.filter(regex="-RT_cal").sum(axis=1)
        Res_DF.loc[:, "Total_CH_KW"] = Res_DF.filter(regex="-CH_KW").sum(axis=1)
        Res_DF.loc[:, "Total_CH_KWRT"] = Res_DF.loc[:, "Total_CH_KW"] / Res_DF.loc[:, "Total_RT"]
        Res_DF.loc[:, "Twb_cal"] = Res_DF.filter(regex="TCWR_").mean(axis=1)
        Res_DF.loc[:, "TCHD_cal"] = Res_DF.filter(regex="-TCHD_cal").mean(axis=1)
        Res_DF.loc[:, "QCH"] = Res_DF.filter(regex="-QCH").mean(axis=1) / 1000
        Res_DF.loc[:, "Total_RT"] = np.where(Res_DF.loc[:, "Total_RT"]<=0, np.nan, Res_DF.loc[:, "Total_RT"])
        Res_DF.loc[:, "AHU_CCVC"] = np.where(Res_DF.loc[:, "AHU_CCVC"]<=0, np.nan, Res_DF.loc[:, "AHU_CCVC"])
    else:
        for data in HVAC_data_list:
            temp = pd.read_csv(os.path.join(OUTPUT_DATA_PATH, F"{data}_data.csv"))
            temp.set_index("timestamp", inplace=True)
            if "AHU" in data:
                temp.columns = [F"{col.split('-')[1]}" for col in temp.columns]
            data_list.append(temp)
        Res_DF = pd.concat(data_list, axis=1, join="outer")
        Res_DF.loc[:, "AHU_OCC"] = np.where(Res_DF.loc[:, "AHU_OCC"]==0, np.nan, 1)
        Res_DF.loc[:, "Twb_cal"] = Res_DF.filter(regex="TCWR_").mean(axis=1)
        Res_DF.loc[:, "Total_RT"] = Res_DF.filter(regex="RT_cal").sum(axis=1)
        Res_DF.loc[:, "Total_CH_KWRT"] = Res_DF.loc[:, "CH_KW"] / Res_DF.loc[:, "Total_RT"]
        Res_DF.loc[:, "QCH"] = Res_DF.loc[:, "QCH"] / 1000
        Res_DF.loc[:, "Total_RT"] = np.where(Res_DF.loc[:, "Total_RT"]<=0, np.nan, Res_DF.loc[:, "Total_RT"])
        Res_DF.loc[:, "AHU_CCVC"] = np.where(Res_DF.loc[:, "AHU_CCVC"]<=0, np.nan, Res_DF.loc[:, "AHU_CCVC"])
    return Res_DF.dropna()
CH_mode = "CH_22_3"
AHU_Device = "AHU_15"
test = merge_HVAC_data(CH_mode, AHU_Device)
display(test.head())
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... RT_cal KWRT_cal COP_cal AHU_CCVC AHU_OCC AHU_TAS AHU_TAS_SP Twb_cal Total_RT Total_CH_KWRT
timestamp
2020-05-01 11:00:00+00:00 867.7 36.2 10.6 27.4 488.405802 8.622222 23.922222 3.911111 4.444444 1086.01 ... 760.890873 0.761699 4.615995 19.0 1.0 19.722222 20.0 16.411111 761.652572 0.760937
2020-05-01 11:15:00+00:00 867.7 36.2 10.0 27.4 469.813125 7.955556 23.505556 3.222222 4.444444 1042.88 ... 735.377687 0.757475 4.641739 17.0 1.0 19.444444 20.0 16.333333 736.135162 0.756695
2020-05-01 11:30:00+00:00 867.7 36.0 10.5 27.4 479.889552 7.461111 21.405556 2.688889 4.444444 898.14 ... 757.321291 0.638144 5.509729 17.0 1.0 19.722222 20.0 16.511111 757.959435 0.637607
2020-05-01 11:45:00+00:00 867.7 36.0 10.5 27.4 479.181000 7.088889 23.005556 2.627778 4.444444 830.20 ... 706.904657 0.646282 5.440347 17.0 1.0 19.722222 20.0 18.744444 707.550940 0.645692
2020-05-01 12:00:00+00:00 867.7 36.0 9.6 27.4 470.664750 6.761111 25.183333 2.672222 4.444444 765.71 ... 636.407363 0.678465 5.182288 16.0 1.0 19.722222 20.0 19.477778 637.085828 0.677742

5 rows × 27 columns

In [ ]:
# Compare
X_targ = "AHU_TAS"
Y_targ = "TASD"
Hue = "TCHD_class"

test_dict = {"CH_22_3":{}, "CH_22_4": {}, "Mix": {}}
for ch in ["CH_22_3", "CH_22_4", "Mix"]:
    for ahu in ["AHU_5", "AHU_7", "AHU_15"]:
        temp = merge_HVAC_data(ch, ahu)
        temp.loc[:, "TASD"] = temp["AHU_TAS"] - temp["AHU_TAS_SP"]
        # temp.loc[:, "TASD"] = np.where(temp.loc[:, "TASD"]<0, np.nan, temp.loc[:, "TASD"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=7, temp.loc[:, "TCHD_cal"]<9), 8, 10)
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=5, temp.loc[:, "TCHD_cal"]<7), 6, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=3, temp.loc[:, "TCHD_cal"]<5), 4, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=1, temp.loc[:, "TCHD_cal"]<3), 2, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=-1, temp.loc[:, "TCHD_cal"]<1), 0, temp.loc[:, "TCHD_class"])
        test_dict[ch][ahu] = temp

fig, ax = plt.subplots(3, 3, figsize=(18, 18))
for ch, idx in zip(["CH_22_3", "CH_22_4", "Mix"], [0, 1, 2]):
    for ahu, idy in zip(["AHU_5", "AHU_7", "AHU_15"], [0, 1, 2]):
        sns.scatterplot(ax=ax[idx, idy], data=test_dict[ch][ahu], x=X_targ, y=Y_targ, hue=Hue, alpha=0.25, palette="hot_r")
        ax[idx, idy].set_title(F"CH: {ch}, AHU: {ahu}")
        ax[idx, idy].axhline(y=0, xmin=0, xmax=1, color="grey")
In [ ]:
# Compare "AHU_CCVC"
X_targ = "AHU_TAS"
Y_targ = "TASD"
Hue = "AHU_CCVC"

test_dict = {"CH_22_3":{}, "CH_22_4": {}, "Mix": {}}
for ch in ["CH_22_3", "CH_22_4", "Mix"]:
    for ahu in ["AHU_5", "AHU_7", "AHU_15"]:
        temp = merge_HVAC_data(ch, ahu)
        temp.loc[:, "TASD"] = temp["AHU_TAS"] - temp["AHU_TAS_SP"]
        # temp.loc[:, "TASD"] = np.where(temp.loc[:, "TASD"]<0, np.nan, temp.loc[:, "TASD"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=7, temp.loc[:, "TCHD_cal"]<9), 8, 10)
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=5, temp.loc[:, "TCHD_cal"]<7), 6, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=3, temp.loc[:, "TCHD_cal"]<5), 4, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=1, temp.loc[:, "TCHD_cal"]<3), 2, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=-1, temp.loc[:, "TCHD_cal"]<1), 0, temp.loc[:, "TCHD_class"])
        test_dict[ch][ahu] = temp

fig, ax = plt.subplots(3, 3, figsize=(16, 16))
for ch, idx in zip(["CH_22_3", "CH_22_4", "Mix"], [0, 1, 2]):
    for ahu, idy in zip(["AHU_5", "AHU_7", "AHU_15"], [0, 1, 2]):
        sns.scatterplot(ax=ax[idx, idy], data=test_dict[ch][ahu], x=X_targ, y=Y_targ, hue=Hue, alpha=0.25, palette="hot_r")
        ax[idx, idy].set_title(F"CH: {ch}, AHU: {ahu}")
        ax[idx, idy].axhline(y=0, xmin=0, xmax=1, color="grey")
In [ ]:
# Compare
X_targ = "AHU_TAS"
Y_targ = "TASD"
Hue = "Total_RT"

test_dict = {"CH_22_3":{}, "CH_22_4": {}, "Mix": {}}
for ch in ["CH_22_3", "CH_22_4", "Mix"]:
    for ahu in ["AHU_5", "AHU_7", "AHU_15"]:
        temp = merge_HVAC_data(ch, ahu)
        temp.loc[:, "TASD"] = temp["AHU_TAS"] - temp["AHU_TAS_SP"]
        # temp.loc[:, "TASD"] = np.where(temp.loc[:, "TASD"]<0, np.nan, temp.loc[:, "TASD"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=7, temp.loc[:, "TCHD_cal"]<9), 8, 10)
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=5, temp.loc[:, "TCHD_cal"]<7), 6, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=3, temp.loc[:, "TCHD_cal"]<5), 4, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=1, temp.loc[:, "TCHD_cal"]<3), 2, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=-1, temp.loc[:, "TCHD_cal"]<1), 0, temp.loc[:, "TCHD_class"])
        test_dict[ch][ahu] = temp

fig, ax = plt.subplots(3, 3, figsize=(16, 16))
for ch, idx in zip(["CH_22_3", "CH_22_4", "Mix"], [0, 1, 2]):
    for ahu, idy in zip(["AHU_5", "AHU_7", "AHU_15"], [0, 1, 2]):
        sns.scatterplot(ax=ax[idx, idy], data=test_dict[ch][ahu], x=X_targ, y=Y_targ, hue=Hue, alpha=0.5, palette="hot_r")
        ax[idx, idy].set_title(F"CH: {ch}, AHU: {ahu}")
        ax[idx, idy].axhline(y=0, xmin=0, xmax=1, color="grey")
In [ ]:
# Compare
X_targ = "AHU_TAS"
Y_targ = "TASD"
Hue = "QCH"

test_dict = {"CH_22_3":{}, "CH_22_4": {}, "Mix": {}}
for ch in ["CH_22_3", "CH_22_4", "Mix"]:
    for ahu in ["AHU_5", "AHU_7", "AHU_15"]:
        temp = merge_HVAC_data(ch, ahu)
        temp.loc[:, "TASD"] = temp["AHU_TAS"] - temp["AHU_TAS_SP"]
        # temp.loc[:, "TASD"] = np.where(temp.loc[:, "TASD"]<0, np.nan, temp.loc[:, "TASD"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=7, temp.loc[:, "TCHD_cal"]<9), 8, 10)
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=5, temp.loc[:, "TCHD_cal"]<7), 6, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=3, temp.loc[:, "TCHD_cal"]<5), 4, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=1, temp.loc[:, "TCHD_cal"]<3), 2, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=-1, temp.loc[:, "TCHD_cal"]<1), 0, temp.loc[:, "TCHD_class"])
        test_dict[ch][ahu] = temp

fig, ax = plt.subplots(3, 3, figsize=(16, 16))
for ch, idx in zip(["CH_22_3", "CH_22_4", "Mix"], [0, 1, 2]):
    for ahu, idy in zip(["AHU_5", "AHU_7", "AHU_15"], [0, 1, 2]):
        df = test_dict[ch][ahu].dropna()
        sns.scatterplot(ax=ax[idx, idy], data=df, x=X_targ, y=Y_targ, hue=Hue, alpha=0.25, palette="hot_r")
        ax[idx, idy].set_title(F"CH: {ch}, AHU: {ahu}")
        ax[idx, idy].axhline(y=0, xmin=0, xmax=1, color="grey")
In [ ]:
# Compare
X_targ = "AHU_TAS"
Y_targ = "TASD"
Hue = "Total_CH_KWRT"

test_dict = {"CH_22_3":{}, "CH_22_4": {}, "Mix": {}}
for ch in ["CH_22_3", "CH_22_4", "Mix"]:
    for ahu in ["AHU_5", "AHU_7", "AHU_15"]:
        temp = merge_HVAC_data(ch, ahu)
        temp.loc[:, "TASD"] = temp["AHU_TAS"] - temp["AHU_TAS_SP"]
        # temp.loc[:, "TASD"] = np.where(temp.loc[:, "TASD"]<0, np.nan, temp.loc[:, "TASD"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=7, temp.loc[:, "TCHD_cal"]<9), 8, 10)
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=5, temp.loc[:, "TCHD_cal"]<7), 6, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=3, temp.loc[:, "TCHD_cal"]<5), 4, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=1, temp.loc[:, "TCHD_cal"]<3), 2, temp.loc[:, "TCHD_class"])
        temp.loc[:, "TCHD_class"] = np.where(np.logical_and(temp.loc[:, "TCHD_cal"]>=-1, temp.loc[:, "TCHD_cal"]<1), 0, temp.loc[:, "TCHD_class"])
        test_dict[ch][ahu] = temp

fig, ax = plt.subplots(3, 3, figsize=(16, 16))
for ch, idx in zip(["CH_22_3", "CH_22_4", "Mix"], [0, 1, 2]):
    for ahu, idy in zip(["AHU_5", "AHU_7", "AHU_15"], [0, 1, 2]):
        sns.scatterplot(ax=ax[idx, idy], data=test_dict[ch][ahu], x=X_targ, y=Y_targ, hue=Hue, alpha=0.25, palette="hot_r")
        ax[idx, idy].set_title(F"CH: {ch}, AHU: {ahu}")
        ax[idx, idy].axhline(y=0, xmin=0, xmax=1, color="grey")
In [ ]:
# RT vs KWRT 1
Load_Data_List = []
for chiller in Chillers.keys():
    if "CH" in chiller:
        temp_df = Chillers[chiller].copy()
        temp_df.loc[:, "Chiller_Name"] = chiller
        temp_df.loc[:, "QCH"] = temp_df.loc[:, "QCH"] / 1000
        temp_df.loc[:, "RT_cal"] = np.where(temp_df.loc[:, "RT_cal"]<=0, np.nan, temp_df.loc[:, "RT_cal"])
        temp.dropna(inplace=True)
        print(F"{chiller} data read: ")
        display(temp_df.head(5))
        Load_Data_List.append(temp_df)

        X_targ = "RT_cal"
        Y_targ = "COP_cal"

        # Plot
        fig, ax = plt.subplots(1, 3, figsize=(27, 8))
        for Hue, idx in zip(["TCHD_cal", "TCHS", "QCH"], [0, 1, 2]):
            sns.scatterplot(ax=ax[idx], data=temp_df, x=X_targ, y=Y_targ, hue=Hue, alpha=0.4, palette="hot_r")
            ax[idx].set_title(F"CH: {chiller} (displayed by {Hue})")
CH_22_3 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-05-01 11:00:00+00:00 867.7 36.2 10.6 27.4 488.405802 8.622222 23.922222 3.911111 4.444444 1086.01 ... 13.166667 15.722222 18.944444 15.888889 18.333333 4.711111 760.890873 0.761699 4.615995 CH_22_3
2020-05-01 11:15:00+00:00 867.7 36.2 10.0 27.4 469.813125 7.955556 23.505556 3.222222 4.444444 1042.88 ... 13.222222 15.277778 19.055556 15.722222 18.388889 4.733333 735.377687 0.757475 4.641739 CH_22_3
2020-05-01 11:30:00+00:00 867.7 36.0 10.5 27.4 479.889552 7.461111 21.405556 2.688889 4.444444 898.14 ... 13.277778 15.555556 18.222222 18.388889 17.111111 4.772222 757.321291 0.638144 5.509729 CH_22_3
2020-05-01 11:45:00+00:00 867.7 36.0 10.5 27.4 479.181000 7.088889 23.005556 2.627778 4.444444 830.20 ... 13.444444 21.722222 18.333333 18.388889 21.833333 4.461111 706.904657 0.646282 5.440347 CH_22_3
2020-05-01 12:00:00+00:00 867.7 36.0 9.6 27.4 470.664750 6.761111 25.183333 2.672222 4.444444 765.71 ... 13.611111 23.333333 18.722222 18.333333 23.388889 4.088889 636.407363 0.678465 5.182288 CH_22_3

5 rows × 21 columns

CH_22_4 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-07-20 15:30:00+00:00 706.0 58.1 47.7 49.2 841.830177 9.672222 30.161111 5.850000 4.444444 898.24 ... 23.166667 23.611111 23.222222 23.222222 23.777778 3.822222 1064.041670 0.454230 7.740566 CH_22_4
2020-07-20 15:45:00+00:00 706.0 65.1 58.2 52.8 659.298552 10.372222 29.161111 5.938889 4.444444 776.45 ... 23.166667 23.611111 23.111111 23.222222 23.833333 4.433333 966.564235 0.451031 7.795481 CH_22_4
2020-07-20 16:00:00+00:00 706.0 44.7 25.0 39.3 485.994000 12.072222 29.100000 6.200000 4.444444 908.74 ... 23.277778 23.666667 23.333333 23.277778 23.888889 5.872222 943.738349 0.517590 6.793015 CH_22_4
2020-07-20 16:15:00+00:00 706.0 49.1 32.3 39.5 521.903052 12.188889 29.761111 6.133333 4.444444 921.81 ... 23.500000 23.777778 23.611111 23.611111 24.166667 6.055556 1045.110095 0.473778 7.421200 CH_22_4
2020-07-20 16:30:00+00:00 706.0 46.8 28.4 39.5 500.471625 11.933333 29.844444 5.827778 4.444444 936.06 ... 23.722222 23.722222 23.833333 23.500000 23.944444 6.105556 1010.468687 0.497225 7.071250 CH_22_4

5 rows × 21 columns

In [ ]:
# RT vs KWRT 2
Load_Data_List = []
for chiller in Chillers.keys():
    if "CH" in chiller:
        temp_df = Chillers[chiller].copy()
        temp_df.loc[:, "Chiller_Name"] = chiller
        temp_df.loc[:, "QCH"] = temp_df.loc[:, "QCH"] / 1000
        temp_df.loc[:, "RT_cal"] = np.where(temp_df.loc[:, "RT_cal"]<=0, np.nan, temp_df.loc[:, "RT_cal"])
        temp.dropna(inplace=True)
        print(F"{chiller} data read: ")
        display(temp_df.head(5))
        Load_Data_List.append(temp_df)

        X_targ = "RT_cal"
        Y_targ = "KWRT_cal"

        # Plot
        fig, ax = plt.subplots(1, 3, figsize=(27, 8))
        for Hue, idx in zip(["TCHD_cal", "TCHS", "QCH"], [0, 1, 2]):
            sns.scatterplot(ax=ax[idx], data=temp_df, x=X_targ, y=Y_targ, hue=Hue, alpha=0.4, palette="hot_r")
            ax[idx].set_title(F"CH: {chiller} (displayed by {Hue})")
CH_22_3 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-05-01 11:00:00+00:00 867.7 36.2 10.6 27.4 488.405802 8.622222 23.922222 3.911111 4.444444 1086.01 ... 13.166667 15.722222 18.944444 15.888889 18.333333 4.711111 760.890873 0.761699 4.615995 CH_22_3
2020-05-01 11:15:00+00:00 867.7 36.2 10.0 27.4 469.813125 7.955556 23.505556 3.222222 4.444444 1042.88 ... 13.222222 15.277778 19.055556 15.722222 18.388889 4.733333 735.377687 0.757475 4.641739 CH_22_3
2020-05-01 11:30:00+00:00 867.7 36.0 10.5 27.4 479.889552 7.461111 21.405556 2.688889 4.444444 898.14 ... 13.277778 15.555556 18.222222 18.388889 17.111111 4.772222 757.321291 0.638144 5.509729 CH_22_3
2020-05-01 11:45:00+00:00 867.7 36.0 10.5 27.4 479.181000 7.088889 23.005556 2.627778 4.444444 830.20 ... 13.444444 21.722222 18.333333 18.388889 21.833333 4.461111 706.904657 0.646282 5.440347 CH_22_3
2020-05-01 12:00:00+00:00 867.7 36.0 9.6 27.4 470.664750 6.761111 25.183333 2.672222 4.444444 765.71 ... 13.611111 23.333333 18.722222 18.333333 23.388889 4.088889 636.407363 0.678465 5.182288 CH_22_3

5 rows × 21 columns

CH_22_4 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-07-20 15:30:00+00:00 706.0 58.1 47.7 49.2 841.830177 9.672222 30.161111 5.850000 4.444444 898.24 ... 23.166667 23.611111 23.222222 23.222222 23.777778 3.822222 1064.041670 0.454230 7.740566 CH_22_4
2020-07-20 15:45:00+00:00 706.0 65.1 58.2 52.8 659.298552 10.372222 29.161111 5.938889 4.444444 776.45 ... 23.166667 23.611111 23.111111 23.222222 23.833333 4.433333 966.564235 0.451031 7.795481 CH_22_4
2020-07-20 16:00:00+00:00 706.0 44.7 25.0 39.3 485.994000 12.072222 29.100000 6.200000 4.444444 908.74 ... 23.277778 23.666667 23.333333 23.277778 23.888889 5.872222 943.738349 0.517590 6.793015 CH_22_4
2020-07-20 16:15:00+00:00 706.0 49.1 32.3 39.5 521.903052 12.188889 29.761111 6.133333 4.444444 921.81 ... 23.500000 23.777778 23.611111 23.611111 24.166667 6.055556 1045.110095 0.473778 7.421200 CH_22_4
2020-07-20 16:30:00+00:00 706.0 46.8 28.4 39.5 500.471625 11.933333 29.844444 5.827778 4.444444 936.06 ... 23.722222 23.722222 23.833333 23.500000 23.944444 6.105556 1010.468687 0.497225 7.071250 CH_22_4

5 rows × 21 columns

In [ ]:
# RT vs KWRT 3
Load_Data_List = []
for chiller in Chillers.keys():
    if "CH" in chiller:
        temp_df = Chillers[chiller].copy()
        temp_df.loc[:, "Chiller_Name"] = chiller
        temp_df.loc[:, "QCH"] = temp_df.loc[:, "QCH"] / 1000
        temp_df.loc[:, "RT_cal"] = np.where(temp_df.loc[:, "RT_cal"]<=0, np.nan, temp_df.loc[:, "RT_cal"])
        temp.dropna(inplace=True)
        print(F"{chiller} data read: ")
        display(temp_df.head(5))
        Load_Data_List.append(temp_df)

        X_targ = "RT_cal"
        Y_targ = "KWRT_cal"

        # Plot
        Fig = go.Figure()
        Fig.add_trace(go.Scatter(name="RT-KWRT", x=temp_df[X_targ], y=temp_df[Y_targ], mode="markers"))
        Fig.update_layout(
            title = dict(text=F"Cooling Load vs KW/RT (Chiller: {chiller})", x=0.04, y=0.83),
            xaxis = dict(
                title=dict(text="Cooling Load (RT)", font=dict(size=12), standoff=0),
                showline=True, linewidth=1.2, linecolor="black",
                showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
                rangeslider=dict(visible=False)),
            yaxis = dict(
                title=dict(text="Energy Performance (KW/RT)", font=dict(size=12), standoff=0),
                dtick=0.1,
                showline=True, linewidth=1.2, linecolor="black",
                zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
                showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
            legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
            plot_bgcolor="white", width=700, height=400)
        Fig.show()
CH_22_3 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-05-01 11:00:00+00:00 867.7 36.2 10.6 27.4 488.405802 8.622222 23.922222 3.911111 4.444444 1086.01 ... 13.166667 15.722222 18.944444 15.888889 18.333333 4.711111 760.890873 0.761699 4.615995 CH_22_3
2020-05-01 11:15:00+00:00 867.7 36.2 10.0 27.4 469.813125 7.955556 23.505556 3.222222 4.444444 1042.88 ... 13.222222 15.277778 19.055556 15.722222 18.388889 4.733333 735.377687 0.757475 4.641739 CH_22_3
2020-05-01 11:30:00+00:00 867.7 36.0 10.5 27.4 479.889552 7.461111 21.405556 2.688889 4.444444 898.14 ... 13.277778 15.555556 18.222222 18.388889 17.111111 4.772222 757.321291 0.638144 5.509729 CH_22_3
2020-05-01 11:45:00+00:00 867.7 36.0 10.5 27.4 479.181000 7.088889 23.005556 2.627778 4.444444 830.20 ... 13.444444 21.722222 18.333333 18.388889 21.833333 4.461111 706.904657 0.646282 5.440347 CH_22_3
2020-05-01 12:00:00+00:00 867.7 36.0 9.6 27.4 470.664750 6.761111 25.183333 2.672222 4.444444 765.71 ... 13.611111 23.333333 18.722222 18.333333 23.388889 4.088889 636.407363 0.678465 5.182288 CH_22_3

5 rows × 21 columns

CH_22_4 data read: 
CHP_KWH CHP_A CHP_KW CHP_VFD QCH TCHR TCWS TCHS TCHS_SP IPCT ... TCWR_1 TCWR_2 TCWR_3 TCWR_4 TCWR_5 TCHD_cal RT_cal KWRT_cal COP_cal Chiller_Name
timestamp
2020-07-20 15:30:00+00:00 706.0 58.1 47.7 49.2 841.830177 9.672222 30.161111 5.850000 4.444444 898.24 ... 23.166667 23.611111 23.222222 23.222222 23.777778 3.822222 1064.041670 0.454230 7.740566 CH_22_4
2020-07-20 15:45:00+00:00 706.0 65.1 58.2 52.8 659.298552 10.372222 29.161111 5.938889 4.444444 776.45 ... 23.166667 23.611111 23.111111 23.222222 23.833333 4.433333 966.564235 0.451031 7.795481 CH_22_4
2020-07-20 16:00:00+00:00 706.0 44.7 25.0 39.3 485.994000 12.072222 29.100000 6.200000 4.444444 908.74 ... 23.277778 23.666667 23.333333 23.277778 23.888889 5.872222 943.738349 0.517590 6.793015 CH_22_4
2020-07-20 16:15:00+00:00 706.0 49.1 32.3 39.5 521.903052 12.188889 29.761111 6.133333 4.444444 921.81 ... 23.500000 23.777778 23.611111 23.611111 24.166667 6.055556 1045.110095 0.473778 7.421200 CH_22_4
2020-07-20 16:30:00+00:00 706.0 46.8 28.4 39.5 500.471625 11.933333 29.844444 5.827778 4.444444 936.06 ... 23.722222 23.722222 23.833333 23.500000 23.944444 6.105556 1010.468687 0.497225 7.071250 CH_22_4

5 rows × 21 columns

In [ ]:
# Plot Timeseries & Analysis Table
Total_Load_cal = pd.concat(Load_Data_List, axis=1, join="outer")
Total_Load_cal.loc[:, "RT_total"] = Total_Load_cal["RT_cal"].sum(axis=1)
Load_Data_DF = pd.concat(Load_Data_List, axis=0)
Chiller_List = list(Load_Data_DF.loc[:, "Chiller_Name"].unique())
Fig = go.Figure()
for chiller in Chiller_List:
    Fig.add_trace(go.Scatter(name=chiller, x=Load_Data_DF[Load_Data_DF["Chiller_Name"]==chiller].index, y=Load_Data_DF[Load_Data_DF["Chiller_Name"]==chiller]["RT_cal"]))
# Fig.add_trace(go.Scatter(name="RT_total", x=Total_Load_cal.index, y=Total_Load_cal["RT_total"], marker=dict(color="rgba(102, 204, 153, 0.8)")))
Fig.update_layout(
    title = dict(text=F"Cooling Load Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Cooling Load (RT)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
Fig.show()
In [ ]:
# TCH Analysis
Load_Data_DF.reset_index(drop=False, inplace=True)
TCH_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["TCHS", "TCHR"]).describe().round(2)
print("Chilled Water Analysis")
display(TCH_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["TCHS", "TCHR"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["TCHS"][Chiller_name]
        y_targ2 = DF["TCHR"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-TCHS", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-TCHR", x=x_targ, y=y_targ2, mode="lines", line=dict(color=color_thin), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"TCH Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Temp. (<sup>o</sup>C)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
Chilled Water Analysis
TCHR TCHS
Chiller_Name CH_22_3 CH_22_4 CH_22_3 CH_22_4
count 12542.00 578.00 12542.00 578.00
mean 9.89 11.05 5.74 5.73
std 1.65 0.66 1.09 0.23
min 4.84 9.51 2.29 4.87
25% 8.83 10.63 5.31 5.63
50% 10.07 11.06 5.66 5.72
75% 11.32 11.54 6.59 5.83
max 15.42 12.96 9.38 7.04
In [ ]:
# QCH Analysis
Load_Data_DF.reset_index(drop=False, inplace=True)
QCH_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["QCH"]).describe().round(2)
print("QCH Analysis")
display(QCH_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["QCH"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["QCH"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-QCH", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"QCH Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="QCH (CMH)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
QCH Analysis
QCH
Chiller_Name CH_22_3 CH_22_4
count 12542.00 578.00
mean 724.93 784.50
std 137.42 169.19
min 421.13 436.46
25% 620.27 778.10
50% 731.40 852.69
75% 828.49 904.04
max 1196.82 1081.70
In [ ]:
# TCW Analysis
Load_Data_DF.loc[:, "TCWR"] = Load_Data_DF.loc[:, ["TCWR_1", "TCWR_2", "TCWR_3", "TCWR_4", "TCWR_5"]].mean(axis=1)
TCW_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["TCWS", "TCWR"]).describe().round(2)
print("Cooling Water Analysis")
display(TCW_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["TCWS", "TCWR"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["TCWS"][Chiller_name]
        y_targ2 = DF["TCWR"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-TCWS", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-TCWR", x=x_targ, y=y_targ2, mode="lines", line=dict(color=color_thin), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"TCW Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Temp. (<sup>o</sup>C)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
Cooling Water Analysis
TCWR TCWS
Chiller_Name CH_22_3 CH_22_4 CH_22_3 CH_22_4
count 12542.00 578.00 12542.00 578.00
mean 21.46 21.60 27.14 26.76
std 1.60 1.26 1.83 1.78
min 9.26 19.41 15.12 23.19
25% 20.71 20.62 25.96 25.38
50% 21.58 21.46 27.16 26.59
75% 22.41 22.69 28.42 28.05
max 26.50 24.51 33.26 31.88
In [ ]:
# RT Analysis
RT_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["RT_cal"]).describe().round(2)
print("Cooling Load Analysis")
display(RT_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["RT_cal"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["RT_cal"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-RT", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"Cooling Load Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Cooling Load (USRT)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
Cooling Load Analysis
RT_cal
Chiller_Name CH_22_3 CH_22_4
count 12542.00 578.00
mean 1014.86 1362.25
std 347.59 289.81
min 114.88 826.04
25% 720.33 1085.38
50% 959.34 1398.41
75% 1284.17 1589.03
max 2335.06 2132.13
In [ ]:
# KWRT Analysis
COP_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["COP_cal"]).describe().round(2)
print("Chiller Performance Analysis")
display(COP_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["COP_cal"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["COP_cal"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-COP", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"Chiller Performance Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Chiller Performance (COP)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
Chiller Performance Analysis
COP_cal
Chiller_Name CH_22_3 CH_22_4
count 12542.00 578.00
mean 6.22 6.94
std 0.45 0.45
min 2.09 5.69
25% 5.95 6.68
50% 6.28 6.97
75% 6.53 7.19
max 9.73 9.84
In [ ]:
# KWRT Analysis
KWRT_analysis = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["KWRT_cal"]).describe().round(2)
print("Chiller Performance Analysis")
display(KWRT_analysis)

DF = Load_Data_DF.pivot_table(index="timestamp", columns="Chiller_Name", values=["KWRT_cal"])
x_targ = DF.index
fig = go.Figure()
for Chiller_name, color_thick, color_thin in zip(Chiller_List, ["#2CBDFE", "#00cc99"], ["#80d6fe", "#b3ffec"]):
    try:
        y_targ1 = DF["KWRT_cal"][Chiller_name]
        fig.add_trace(go.Scatter(name=F"{Chiller_name}-KWRT", x=x_targ, y=y_targ1, mode="lines", line=dict(color=color_thick), showlegend=True))
    except:
        print(F"{Chiller_name} Data is not sufficient to plot...\n")

fig.update_layout(
    title = dict(text=F"Chiller Performance Timeseries", x=0.04, y=0.83),
    xaxis = dict(
        showline=True, linewidth=1.2, linecolor="black",
        showticklabels=True, showgrid=True, gridcolor="rgba(230, 230, 230, 1)",
        rangeslider=dict(visible=False)),
    yaxis = dict(
        title=dict(text="Chiller Performance (KW/RT)", font=dict(size=12), standoff=0),
        showline=True, linewidth=1.2, linecolor="black",
        zeroline=True, zerolinewidth=1.2, zerolinecolor="rgba(230, 230, 230, 1)",
        showgrid=True, gridcolor="rgba(230, 230, 230, 1)"),
    legend = dict(x=1.02, y=0.5, orientation="v", bordercolor="black", borderwidth=0.5, font=dict(size=8)),
    plot_bgcolor="white", width=1000, height=400)
fig.show()
Chiller Performance Analysis
KWRT_cal
Chiller_Name CH_22_3 CH_22_4
count 12542.00 578.00
mean 0.57 0.51
std 0.05 0.03
min 0.36 0.36
25% 0.54 0.49
50% 0.56 0.50
75% 0.59 0.53
max 1.68 0.62